<div class="navbar-tit">
    <div class="wrap">
        <a href="/account" id="10005">总览</a>
        <a href="/account/backlend" id="10006">投标概况</a>
        <a href="/fund/activity" id="10007">交易明细</a>
        <a href="/account/await" id="10008">待回款</a>
        <a href="/count/lend" id="10019">理财统计</a>
        <a href="/account/myloan" id="10009">我的借款</a>
        <a href="/count/borrow" id="10010">借款统计</a>
        <a href="/user/basicinfo" id="10011">基础资料</a>
        <a href="/user/security" id="10012">安全信息</a>
    </div>
</div>
<input type="hidden" id="auth_result" name="auth_result" value="<?php echo $auth; ?>" />
<div class="next_head">
    <div class="wrap">账户充值</div>
</div>
<div class="bank_nav">
    <form class="form-horizontal" role="form" method="POST" action="<?php echo url_for('account/recharge')?>">
        <div class="select_bank wrap">
            <h2>选择充值方式</h2>
            
            <h4>充值银行</h4>
            <ul>
                <?php foreach($bank_list as $k): ?>
                <li>
                    <div class="radio">
                        <label>
                            <input type="radio" class="bankradio" name="Bank" id="<?php echo $k->getBankCode(); ?>" value="<?php echo $k->getBankCode(); ?>">
                            <img src="<?php echo image_path('bank/'.$k->getBankCode().'.gif')?>" width="142" />
                        </label>
                    </div>
                </li>
                <?php endforeach;?>
            </ul>
            <div class="line_main">
                <div class="line">
                    <a href="javascript:void(0)" id="lookathor">查看更多</a>
                </div>
            </div>
            <input type="hidden" name="InpourType" value="1" />
            <h2>填写充值金额</h2>
            <div class="bankfrom">
                <?php if ($sf_user->hasFlash('error')): ?>
                   <?php if ($sf_user->getFlash('error')=="请先绑定银行卡"): ?>
                    <div class="alert alert-danger  " > <a data-toggle="modal" data-target="#withdrawcashmodel"> <?php echo $sf_user->getFlash('error') ?></a></div>
                   <?php else:?>
                    <div class="alert alert-danger  " > <?php echo $sf_user->getFlash('error') ?></div>
                   <?php endif;?>
                <?php endif;?>
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-3 control-label ft-l">账户余额</label>
                    <div class="col-sm-9 ft-l">
                        <p class="form-control-static"><?php echo sfConfig::get('app_symbol').number_format($user->getRemainingMoney(),2);?>元</p>
                    </div>
                </div>
                <div class="form-group">
                    <label for="Amount" class="col-sm-3 control-label  ft-l">充值金额</label>
                    <div class="col-sm-4  ft-l">
                        <input type="text" class="form-control ft-l" id="Amount"  onkeyup="value=value.replace(/[^\d.]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))"  placeholder="充值金额" name="Amount">
                    </div>
                    <p class="form-control-static">元</p>
                </div>
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-3 control-label  ft-l ">充值费用</label>
                    <div class="col-sm-9  ft-l shouxu">
                        <p class="form-control-static"><span id="rechAmount">0.00</span>元</p>
                    </div>
                    <span class="icon20_b icon_qust ft-l" id="shouxu" data-original-title="" title=""></span>
                    <span class=" ft-l form-control-static"><a href="http://www.vmdai.com/notice/detail/2" target="_blank">微美贷上线，充值免手续费（第一期）</a></span>
                </div>
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-3 control-label  ft-l">实际到账金额</label>
                    <div class="col-sm-9  ft-l">
                        <p class="form-control-static"><span id="rechAmountrel">0.00</span>元</p>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-9">
                        <button type="submit" class="btn btn-primary">充值</button>
                    </div>
                </div>

            </div>
            <h4>温馨提示</h4>
            <dl>
                <dd>•&nbsp;&nbsp;&nbsp;&nbsp;为了您的账户安全，请在充值前进行身份认证、手机绑定。</dd>
                <dd>•&nbsp;&nbsp;&nbsp;&nbsp;您的账户资金将通过第三方平台进行充值。</dd>
                <dd>•&nbsp;&nbsp;&nbsp;&nbsp;请注意您的银行卡充值限制，以免造成不便。</dd>
                <dd>•&nbsp;&nbsp;&nbsp;&nbsp;禁止洗钱、信用卡套现、虚假交易等行为，一经发现并确认，将终止该账户的使用。</dd>
                <dd>•&nbsp;&nbsp;&nbsp;&nbsp;如果充值金额没有及时到账，请联系客服，400-875-6699</dd>
            </dl>
        </div>
    </form>
</div>

<div class="modal fade" id="withdrawcashmodel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title" id="myModalLabel">添加银行卡
                </h4>
            </div>
            <div class="modal-body">
                <iframe src="<?php echo url_for('account/bindcard')?>" width="100%" style="border: none; height: 520px;"></iframe>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>

<script type="text/javascript">
    $(function ($) {
        $("#10003").addClass('on');
        $("#Amount").on('keyup', function () {
            if (Number($("#Amount").val()) >= 100000000) {
                $("#Amount").val(100000000);
            }

            $("#rechAmount").text((Number($("#Amount").val() * 0.003)).toFixed(2));
            $("#rechAmountrel").text((Number($("#Amount").val() - (Number($("#Amount").val()) * 0.003))).toFixed(2));

        });
        var options = {
            selector: false,
            html: true,
            content: "按照充值金额的0.3%每笔",
            placement: 'right',
            trigger: 'hover'
        };
        $("#shouxu").popover(options);
        $("#WithDrawAmount").on('keyup', function () {
            $("#Amountsx").text("¥" + Math.ceil(((Number($(this).val()) / 50000 * 10000) / 10000)) * 5);
        });
        //弹出框
        if($("#auth_result").val() == "0"){
                $.vmalert({
                    title: '提示',
                    content: '<div class="rechalert"><i class="icon20_g icon_alert ft-l" ></i><div class="ft-l">尚未全部完成<span>实名认证、绑定手机</span>，请前往<a href="<?php echo url_for("user/security"); ?>" target="_blank">安全信息</a>认证！</div></div>',
                    modelid: 'rechmodal',
                    size_w: 'sm',
                    tBtn: '完善认证',
                    href: '<?php echo url_for("user/security"); ?>'
                });
        }
        
            
        $("#lookathor").on('click', function () {
            $('.select_bank').find('ul').css('height', 'auto');
            $(this).parents("div[class='line_main']").remove();
        });

        $("#BindCard").click(function () {

        });
    })
</script>

